const btns = [
  // 删除
  (h, params, vm) => {
    return h('Poptip', {
      props: {
        confirm: true,
        transfer: true,
        title: vm.$t('delete-tips')
      },
      on: {
        'on-ok': () => {
          vm.handleRemove([params.row], vm)
        }
      }
    }, [
      h('HandleBtn', {
        props: {
          title: vm.$t('delete'),
          iconType: 'md-trash',
          iconColor: '#ed4014',
          access: 'admin,sys:role:remove'
        }
      })
    ])
  },
  // 查看
  (h, params, vm) => {
    return h('HandleBtn', {
      props: {
        title: '查看',
        iconType: 'md-eye',
        access: 'admin,sys:role:get'
      },
      on: {
        click: e => {
          vm.openEdit(vm, params.row, false)
        }
      }
    })
  },
  // 修改
  (h, params, vm) => {
    return h('HandleBtn', {
      props: {
        title: vm.$t('edit'),
        iconType: 'ios-create',
        iconColor: '#67c23a',
        access: 'admin,sys:role:update'
      },
      on: {
        click: e => {
          vm.openEdit(vm, params.row)
        }
      }
    })
  },
  // 权限设置
  (h, params, vm) => {
    return h('HandleBtn', {
      props: {
        title: '权限设置',
        iconType: 'md-settings',
        access: 'admin,sys:rbac:saveRoleResource',
        iconColor: params.row.isSuperAdminRole === true ? '#e3e3e3' : '#000000'
      },
      on: {
        click: e => {
          if (params.row.isSuperAdminRole !== true) {
            vm.openAuth(vm, params.row)
          }
        }
      }
    })
  },
  // 成员管理
  (h, params, vm) => {
    return h('HandleBtn', {
      props: {
        title: '成员管理',
        iconType: 'ios-people',
        access: 'admin,sys:rbac:saveAdminRole',
        iconColor: params.row.isSuperAdminRole === true ? '#e3e3e3' : '#000000'
      },
      on: {
        click: e => {
          if (params.row.isSuperAdminRole !== true) {
            vm.colSpan = 12
            vm.$set(vm.currentRow, 'id', params.row.id)
            vm.$set(vm.currentRow, 'name', params.row.name)
          }
        }
      }
    })
  }
]

export default btns
